package com.chagee.store.operation.server.service.third;

import cn.hutool.json.JSONUtil;
import com.chagee.base.utils.HttpResponse;
import com.chagee.store.operation.server.feign.UmuApi;
import com.chagee.store.operation.server.model.response.UmuUserResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author : hk
 * @Date : 2025/2/28
 */

@Service
@Slf4j
@RequiredArgsConstructor
public class UmuThirdService {

	@Resource
	private UmuApi umuApi;

	public UmuUserResponse getManagerByStoreCode(String storeCode) {
		log.info("UmuThirdService.getManagerByStoreCode_request: {}", storeCode);
		try {
			HttpResponse<UmuUserResponse> httpResponse = umuApi.getManagerByStoreCode(storeCode);
			log.info("UmuThirdService.getManagerByStoreCode_response: {}", JSONUtil.toJsonStr(httpResponse));
			return httpResponse.getData();
		} catch (Exception e) {
			log.error("UmuThirdService.getManagerByStoreCode_error: ", e);
			return null;
		}
	}
}
